<?php

/**
 * 国际快递公司 
 */
class Application_Model_Express extends Application_Model_DomainObject{
    
    protected $_id;
    
    protected $_name;//名称
    
    protected $_firstWeight;//首重
    
    protected $_subsequentWeight;//续重

    protected $_fuelSurcharge;//燃油费率
    
    protected $_isVolume;//是否要体积重量
    
    protected $_typeMark;//货物类型掩码 如接收些类型，进行“与”运算后为真
    
    protected $_description;//说明
    
    protected $_remark;//内部备注
    
    protected $_isDisable;//是否禁用

    protected $_logo;//图标

    protected $_reportFee;//报关费
    
    protected $_unitWeight;//每个单位重量是多少，用于在计进行单价报价方式时进行记录
    
    protected $_isSpecific;//是否特殊通道

    protected $_orderBy;
    

    const Express_AIR = 4;

    const Express_DHLBrand=6;

    /**
     * 判断该物流是否接收此类型的货物
     * @param int $type 货物类型
     * @param Application_Model_ExpressPrice $expressPrice
     * @return bool 
     */
    public function isAccept($type,$expressPrice =NULL){
        if(!$type)
            $type=0;
        if($expressPrice == NULL || $expressPrice->TypeMark == NULL || $expressPrice->TypeMark == ''){
            $result =((intval($type) &intval($this->_typeMark)) == $type);
            //echo 't:'.$type.'||m:'.$this->_typeMark. '====='. (intval($type) & intval($this->_typeMark)).'======';
            return $result;
        }
        
        $result =((intval($type) &intval($expressPrice->TypeMark)) == $type);
        return $result;
    }
    
    /**
     * 根据城市ID返回对应的报价
     * @param int $cityId
     * @return array 
     */
    public static function getPricesByCity($cityId){
        return Application_Model_ExpressPrice::getPricesByCity($cityId);
    }
    
    public static function getPricesByExpress($expressId){
        return Application_Model_ExpressPrice::getPricesByExpress($expressId);
    }

    public static function getAll(){
        return self::getDao()->queryAll(array());
    }
    
    
}